<template>
  <div>
    <!-- 
            Header Attributes
            height	顶栏高度	string	—	60px
            Aside Attributes
            width	侧边栏宽度	string	—	300px
         -->
    <el-container>
      <el-header height="80px">XXXX大型后台管理系统
        <div>你好:{{$store.getters.getUser.username}}</div>
        <div>
          <el-button type="danger" size="small" @click="logout">退出</el-button>
        </div>
      </el-header>
      <el-container>
        <el-aside width="260px">
          <v-nav></v-nav>
        </el-aside>
        <el-main>
            <!-- 二级路由出口 -->
            <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
    <!-- <el-container>
            <el-aside>111</el-aside>
            <el-container>
                <el-header>头部</el-header>
                <el-main>中心主体内容</el-main>
            </el-container>
        </el-container> -->
  </div>
</template>

<script>
//引入封装好的子组件
import vNav from "../components/vNav.vue";
export default {
  data() {
    return {};
  },
  components: {
    vNav,
  },
  methods:{
    //封装一个退出事件
    logout(){
      //清空存储
      this.$store.dispatch('changeUserAction',false)
      //跳转回登录
      this.$router.push('/login')
    }
  }
};
</script>

<style lang="less" scoped>
.el-header {
  background-color: pink;
}
</style>
